package gravity;

import java.util.*;
import javax.vecmath.*;

public class Simulation {
	Vector<MassiveBody> bodiesList;
	double interval;

	public void update() {
		if (bodiesList.size() > 1) {
			MassiveBody currentBody;
			MassiveBody otherBody;
			for (int current = 0; current < bodiesList.size(); ++current) {
				currentBody = bodiesList.elementAt(current);
				for (int other = 0; other < bodiesList.size(); ++other) {
					if (current != other) {
						otherBody = bodiesList.elementAt(other);
						computeForces(currentBody, otherBody);
					}
				}
			}

		}
	}

	private void computeForces(MassiveBody bodyOne, MassiveBody bodyTwo) {
		double deltaX = bodyTwo.getX() - bodyOne.getX();
		double deltaY = bodyTwo.getY() - bodyOne.getY();
		Vector2d vectorBetween = new Vector2d(deltaX, deltaY);
	}

	public Simulation(double i) {
		interval = i;
		bodiesList = new Vector<MassiveBody>();
	}

	public Simulation() {
		this(1.0);
	}
}
